<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="供应商品信息管理">
<body class="input">

 <script type="text/javascript">
	$().ready( function() {
	
		var $validateErrorContainer = $("#validateErrorContainer");
		var $validateErrorLabelContainer = $("#validateErrorContainer ul");
		var $validateForm = $("#inputForm");
		var $tab = $("#tab");
	
		// Tab效果
		$tab.tabs(".tabContent", {
			tabs: "input"
		});
		
		// 表单验证
		$validateForm.validate({
			errorContainer: $validateErrorContainer,
			errorLabelContainer: $validateErrorLabelContainer,
			wrapper: "li",
			errorClass: "validateError",
			ignoreTitle: true,
			rules: {
					"goodsSupply.goodsCostPrice": {
						required: true
					}
			},
			messages: {
					"goodsSupply.goodsCostPrice": {
						required: "商品进价不能为空！"
					}
			},
			submitHandler: function(form) {
//				$(form).find(":submit").attr("disabled", true);
				form.submit();
			}
		});
	<#if actionErrors?? && (actionErrors?size > 0)>
        $.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
            modal: true, autoCloseTime: 3000});
		</#if>

        $("#submitId").click(function () {
            var validatorPrice = checkPrice();
            return  validatorPrice;
        });
	});


    function checkPrice() {
        $("#priceSpan").html("");
        var ee = /^(([1-9]\d*)|\d)(\.\d{1,3})?$/;
        var blsx = $("#goodsCostPrice").val();
        if (!ee.test(blsx)) {
            $("#priceSpan").html('价格格式不正确！(例：0.000)');
            return false;
        }
        else {
            return true;
        }
    }

    function checkParvalue() {
        $("#priceSpan2").html("");
        var ee = /^(([1-9]\d*)|\d)(\.\d{1,3})?$/;
        var blsx = $("#goodsValue").val();
        if (!ee.test(blsx)) {
            $("#priceSpan2").html('价格格式不正确！(例：0.000)');
            return false;
        }
        else {
            return true;
        }
    }

	</script>

	<div class="body">
		<div class="inputBar">
			<h1><span class="icon">&nbsp;</span>编辑供应商品信息</h1>
		</div>
		<div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
				<div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
				<ul></ul>
		</div>
		<form id="inputForm" class="validate" action="${web_base}/game/goods_supply!edit.htm" method="post">
			<ul class="tab">
				<li>
					<input type="button" value="基本信息" hidefocus="true" />
				</li>
			</ul>
            <input type="hidden" name="goodsSupply.id" class="formText" value="${(goodsSupply.id)!}" />
            <input type="hidden" name="goodsSupply.goodsValue" class="formText" value="${(goodsSupply.goodsValue)!}" />
            <input type="hidden" name="supplyName" class="formText" value="${supplyName!}" />
            <input type="hidden" name="oriGoodsId" class="formText" value="${oriGoodsId!}" />
			<table class="inputTable tabContent">
					<tr>
					<th>
						商品编号:
					</th>
					
					<td>
						<input type="text" name="goodsId" id="goodsId" class="formText {required: true}"
						  value="${(goodsSupply.goodsId)!}"/>
					</td>
				</tr>
				<tr>
					<th>
						品牌编号:
					</th>
					<td>
						<input type="text" name="goodsCategoryId" id="goodsCategoryId" class="formText {required: true}"
						  value="${(goodsSupply.goodsCategoryId)!}"/>
					</td>
				</tr>
					<tr>
					<th>
						商品名称：
					</th>
					<td>
						<input type="text" name="goodsName" id="goodsName" class="formText {required: true}"
						  value="${(goodsSupply.goodsName)!}"/>
					</td>
				</tr>
				<tr>
					<th>
						品牌名称：
					</th>
					<td>
						<input type="text" name="goodsSupply.brandName" id="brandName" class="formText {required: true}"
						  value="${(goodsSupply.brandName)!}"/>
					</td>
				</tr>
				<tr>
					<th>
						供应商名称：
					</th>
					<td>
                        ${(goodsSupply.supplyName)!}
					</td>
				</tr>
				<tr>
					<th>
						供应商原始商品编号：
					</th>
					<td>
                          <input type="text" name="goodsSupply.originalGoodsId" id="originalGoodsId" class="formText {required: true}"
                               value="${(goodsSupply.originalGoodsId)!}"/>
					</td>
				</tr>
                <tr>
                    <th>
                        商品面值：(元)
                    </th>
                    <td>
                            <input type="text" name="goodsValue" id="goodsValue" class="formText {required: true}"
                                   onblur="checkParvalue()" value="${(goodsSupply.goodsValue*1.0/1000)?string("0.000")}"/>
                            <span id="priceSpan2" style="color: red;"></span>
                    </td>
                </tr>
				<tr>
					<th>
						商品成本价格：(元)
					</th>
					<td>
						<input type="text" name="goodsCostPrice" id="goodsCostPrice" class="formText {required: true}"
						 onblur="checkPrice()" value="${(goodsSupply.goodsCostPrice*1.0/1000)?string("0.000")}"/>
                        <span id="priceSpan" style="color: red;"></span>
					</td>
				</tr>

			</table>
			<div class="buttonArea">
				<input type="submit" id="submitId" class="formButton" value="更  新" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
			</div>
		</form>
	</div>
</body>
</@edit>
